package xjvm_v1.instruction.loadandstore.constant;


import xjvm_v1.instruction.Instruction;
import xjvm_v1.interp.BytecodeReader;
import xjvm_v1.interp.CallSite;
import xjvm_v1.interp.Interpreter;
import xjvm_v1.runtime.*;

public class Sipush implements Instruction {

    @Override
    public void execute(RunTimeEnv runTimeEnv, JThread jThread,
                        MyClass javaClass, CallSite callSite,
                        Interpreter interpreter, BytecodeReader code) {
        JavaFrame javaFrame = jThread.getTopFrame();
        OperandStack operandStack = javaFrame.operandStack;

        short shortConstant = code.consumeU2();
        operandStack.putInt(shortConstant);
    }
}
